package top.continew.minithreadpool.ui.cyberpunkUi;

import javax.swing.*;
import java.awt.*;

public class CyberPanel extends JPanel {
    @Override
    protected void paintComponent(Graphics g) {
        super.paintComponent(g);
        Graphics2D g2d = (Graphics2D) g;
        g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
        g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);

        // 绘制网格背景
        g2d.setColor(new Color(20, 20, 30));
        g2d.fillRect(0, 0, getWidth(), getHeight());

        // 绘制网格线
        g2d.setColor(new Color(40, 40, 60));
        for (int x = 0; x < getWidth(); x += 20) {
            g2d.drawLine(x, 0, x, getHeight());
        }
        for (int y = 0; y < getHeight(); y += 20) {
            g2d.drawLine(0, y, getWidth(), y);
        }

        // 绘制发光边框
        g2d.setColor(CyberpunkThreadPoolVisualizer.NEON_BLUE);
        g2d.setStroke(new BasicStroke(2));
        g2d.drawRect(0, 0, getWidth()-1, getHeight()-1);

        // 绘制霓虹光效
        g2d.setPaint(new GradientPaint(
                0, 0, new Color(0, 195, 255, 50),
                getWidth(), getHeight(), new Color(180, 0, 255, 50)
        ));
        g2d.fillRect(0, 0, getWidth(), getHeight());
    }
}
